home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 1999 #2 / Amiga Plus CD - 1999 - No. 2.iso / System-Boost / Workbench / ToolManager / Source / Prefs / debug.c < prev    next >
C/C++ Source or Header  |  1998-06-17  |  1KB  |  72 lines

  1. /*
  2.  * debug.c  V3.1
  3.  *
  4.  * Preferences editor debugging code
  5.  *
  6.  * Copyright (C) 1990-98 Stefan Becker
  7.  *
  8.  * This source code is for educational purposes only. You may study it
  9.  * and copy ideas or algorithms from it for your own projects. It is
  10.  * not allowed to use any of the source codes (in full or in parts)
  11.  * in other programs. Especially it is not allowed to create variants
  12.  * of ToolManager or ToolManager-like programs from this source code.
  13.  *
  14.  */
  15.  
  16. #include "toolmanager.h"
  17.  
  18. /* Local data */
  19. static char TagBuffer[11];
  20.  
  21. #ifdef DEBUGPRINTTAGLIST
  22. static const char PrintHex(ULONG data)
  23. {
  24.  int i;
  25.  
  26.  /* Print Hex introducer */
  27.  TagBuffer[0] = '0';
  28.  TagBuffer[1] = 'x';
  29.  
  30.  /* Print digits (backwards) */
  31.  for (i = 9; i > 1; i--) {
  32.   ULONG digit = data & 0xF;
  33.  
  34.   /* Translate to Hex digit */
  35.   TagBuffer[i] = (digit < 10) ? digit + '0' : digit - 10 + 'A';
  36.  
  37.   /* Next digit */
  38.   data >>= 4;
  39.  }
  40.  
  41.  /* Add string terminator */
  42.  TagBuffer[10] = '\0';
  43. }
  44.  
  45. /* Get tag name */
  46. const char *GetTagName(ULONG tag)
  47. {
  48.  const char *rc;
  49.  
  50.  switch(tag) {
  51.   default: PrintHex(tag); rc = TagBuffer; break;
  52.  }
  53.  
  54.  return(rc);
  55. }
  56.  
  57. /* Get tag data format */
  58. static const char *GetTagFormat(ULONG tag)
  59. {
  60.  const char *rc;
  61.  
  62.  switch (tag) {
  63.   default: rc = "0x%08lx"; break;
  64.  }
  65.  
  66.  return(rc);
  67. }
  68. #endif
  69.  
  70. /* Include global debugging code */
  71. #include "/global_debug.c"
  72.